package com.edu.utils;

import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;

/**
 * @author CharChen
 * @e-mail piggsoft@163.com
 * @since 2013-5-17
 * @version 1.0
 */
public class BeanUtils{
	
	private static final WebApplicationContext  context  = ContextLoader.getCurrentWebApplicationContext() ;
	
	public static <T> T getInstance(String beanName, Class<T> clazz) {
		return context.getBean(beanName, clazz);
	}
	
	public static <T> T getInstance(Class<T> clazz) {
		return context.getBean(clazz);
	}
}
